package top.huxy.boot.util.obj;

import top.huxy.boot.model.entity.Admin;

/**
 * @Classname ThreadLocalAdmin
 * @Description ThreadLocalAdmin
 * @Date 2021/9/24 18:24
 * @Created by huxy
 */
public class ThreadLocalAdmin {
    private static final ThreadLocal<Admin> localUser=new ThreadLocal<>();

    public static Admin current(){
        return localUser.get();
    }
    public static void setCurrentAdmin(Admin admin){
        localUser.remove();
        localUser.set(admin);
    }
    public static void destroy(){
        localUser.remove();
    }
}
